1. Field of the Invention
The present invention relates to a cache memory of a server system that provides mass storage files, and more particularly to a cache method and a cache system for storing file's data in memory blocks divided from a cache memory.
2. Description of the Prior Art
With the increase of multimedia streaming service, a server that provides mass storage files in real time requires efficient loading of the files in a memory. Such loading serves as a main factor that determines performance of the server. Particularly, multimedia service that increases network load is essentially required to reduce processing time of the server so as to reduce delay due to a high volume of network load. To this end, a part of files for streaming is loaded in the memory and the loaded data continues to be maintained so that the time required to read files from a file storage could be reduced. Such a memory is called a cache memory.
FIG. 1 illustrates a structure of a cache system in a conventional streaming server. In FIG. 1, the cache system 30 includes a cache memory 10, a file data reader 11, a cache management module 12, and a memory allocation module 20. The memory allocation module 20 allocates memory constituting a cache from a memory of the system and provides access information on the allocated memory to the cache management module 12.
If data is requested from an application 15, the cache management module 12 identifies whether the requested data is stored in the cache memory 10. If so, the cache management module 12 copies the data and provides the copied data to the application 15. If not so, the cache management module 12 reads the data from the file data reader 11, stores the data in the cache memory 10, and provides the data to the application 15.
The cache memory 10 has access information on the allocated memory and information on which files data is stored and which part of the files the data is stored, in addition to the data read from the file data reader. The cache memory 10 sequentially stores the data provided from the cache management module 12, and if the data requested from the application 15 exists in the previously stored data, the cache memory 10 provides the corresponding data to the application 15. The file data reader 11 reads the data from a file memory 50 and provides the read data to the cache management module 12.
The case where the data is read from the file memory 50 will now be described. First, the memory allocation module 20 generates an available memory and provides the generated memory to the cache memory 10 (a in FIG. 1). Then, the application 15 requests data of a specific file (b). In this case, the file data reader 11 reads desired data from the file memory 50 and then provides the read data to the cache management module 12 (c). The cache management module 12 provides the read cache data to the cache memory 10 (d) and transmits the data to the application 15 (f).
In an instance where the requested data is read from the cache memory 10, the application 15 initially requests the cache management module 12 to provide data of a specific file so as to read the data stored in the cache memory (b). The cache management module 12 reads the requested data from the cache memory (e). The read data is provided to the application 15.
Therefore, since the cached data is read through the cache management module 12 and the cache memory 10 without having to go through the file memory 50 and the file data reader 11, the reading speed is faster than in the case where the data is read from the file memory 50.
FIG. 2 illustrates the state in which the files are stored in the conventional cache memory. A reference block 61 denotes the memory state before caching the data. If a file 1 is to be cached, data is sequentially stored in the cache memory as shown in a reference block 62. If a file 2 is to be cached, contents of the file 1 are deleted and data of the file 2 are stored in the memory. Thus, only the file 2 exists in the cache memory as shown in a reference block 63. Subsequently, if another file stored in the memory is to be cached in a random access mode, the existing data of file 2 is deleted from the cache and the new file data is stored, as shown in a reference block 64.
As such, the conventional cache system has several problems. That is, if the cache randomly accesses the file or multiple applications each requests a different part of the file, it is necessary to delete the existing cache data and load the cache with new data. Also, since data that is not a memory pointer within the cache is transmitted to the application, its performance may deteriorate. Moreover, in the case where a plurality of applications access the cache, the memory in use may be erased without backup.